package cn.t215.cloud.api.user;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class UserServiceRemoteClientFallbackFacotry implements FallbackFactory<UserServiceRemoteClient> {
    @Override
    public UserServiceRemoteClient create(Throwable ex) {
        log.error(ex.getMessage(), ex);
        return new UserServiceRemoteClient() {
            @Override
            public String hello() {
                return "hello()回退服务了";
            }

            @Override
            public List<UserDTO> users() {
                return null;
            }

            @Override
            public UserDTO save(UserDTO user) {
                return null;
            }

            @Override
            public UserDTO save2(UserDTO user) {
                return null;
            }

            @Override
            public UserDTO users(String name, String password) {
                return null;
            }
        };
    }
}
